<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!--
        Vue 指令 v-bind
        1.作用: 动态的设置html的标签属性  src url title...
        2.语法: v-bind:属性名="表达式"
    -->
    <div id="app">
        <button v-show="idx != 0" @click="prev()">上一页</button>
        <div>
            <img :src="imgUrls[idx]" alt="" />
        </div>
        <button v-show="idx < imgUrls.length - 1" @click="next()">下一页</button>
    </div>

    <script src="../lib/vue.js"></script>

    <script>
        const app = new Vue({
            el: "#app",
            data() {
                return {
                    imgUrls: ["../imgs/10-01.png", "../imgs/10-02.png", "../imgs/11-00.gif"
                        , "../imgs/11-01.gif", "../imgs/11-02.gif", "../imgs/11-03.gif"
                        , "../imgs/11-04.png", "../imgs/11-05.png"
                    ],
                    idx: 0
                }
            },
            methods: {
                prev() {
                    this.idx --
                },
                next() {
                    this.idx ++
                }
            }

        })
    </script>
</body>

</html>